package com.pojo;

import com.ValidateGroupInterface.GroupIdInterface;
import com.ValidateGroupInterface.GroupParamInterface;
import com.util.ValidatorMessage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * groups指定组，接受多个groups = {GroupIdInterface.class,GroupIdInterface.class}
 */
@Data
@ApiModel(value = "用户实体类")
public class Group {

    @ApiModelProperty(value = "id")
    @Range(min = 0,max = 80,groups = {GroupIdInterface.class},message = "id最小值为1，最大值是80")
    @NotNull(message = "id不能为空",groups = {GroupIdInterface.class})
    private Integer id;

    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "name"+ValidatorMessage.NOT_BLANL,groups = {GroupParamInterface.class})
    private String name;

    @ApiModelProperty(value = "年龄")
    @Digits(integer = 1,fraction = 80,groups = {GroupParamInterface.class},message = "age在1-0之间")
    @NotNull(groups = {GroupParamInterface.class},message = "年龄不能为空")
    private Integer age;

    @ApiModelProperty(value = "地址")
    @NotBlank(groups = {GroupParamInterface.class},message = "address不能为空")
    private String address;
}
